<!DOCTYPE html>
<html>
	<!--
	作者：offline
	时间：2018-06-27
	描述：添加部门
-->

	<head>
		<!-- 引入框架文件 -->
		<link rel="stylesheet" href="../../model/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<script type="text/javascript" src="../../model/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../../model/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
		<link rel="stylesheet" href="../../static/css/ehr.css" />
		<link rel="stylesheet" href="../../static/css/employee.css" />
		<script type="text/javascript" src="../../model/models.js"></script>
		
		<style type="text/css">
			.content input {
				width: 30%;
			}
			.content select {
				width: 30%;
			}
			.content span {
				margin: 5px 5px;
			}
		</style>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>

		<div include="../../static/header.htm"></div>
		<div style="height: 100%;float: left;" include="../../static/aside.htm"></div>

		<div class="aside2">
			<div include="../../static/coManage.htm"></div>
		</div>
		<!-- 右侧功能框实现 -->
		<div class="section">
			<div include="../../static/coDivisManage.htm"></div>
			<div class="content">
				<!-- 部门信息form -->
				<form id="addDepa">
					<table class="table table-bordered">
						<tr>
							<td>
								<div class="left">
									<span>部门名称：</span>
									<input name="depaName" type="text"  class="form-control"/>
								</div>
							</td>
						</tr>

						<tr>
							<td>
								<div class="left">
									<span>部门编号：</span>
									<input name="serialNum" type="text" placeholder="自动生成！" class="form-control" readonly/>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>类　　型：</span>
									<select name="depaType" class="form-control">
										<option value="公司">公司</option>
										<option value="部门">部门</option>
									</select>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>部门电话：</span>
									<input name="depaPhone" type="text"  class="form-control"/>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>部门传真：</span>
									<input name="depaFax" type="text"  class="form-control"/>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>描　　述：</span>
									<textarea name="depaDesc"  class="form-control" style="width: 30%;height: 70px;"></textarea>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>上级部门：</span>
									<select name="depaHigher.id" id="depaHigher" value=""  class="form-control">
										<option value="1">无</option>
									</select>
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<div class="left">
									<span>成立日期：</span>
									<input name="estDate" type="date"  class="form-control"/>
								</div>
							</td>
						</tr>

					</table>
					<!-- 底部按钮 -->
					<!-- 提交按钮 -->
					<div style="margin: 0 auto; width: 200px; height: 70px; margin-top: 40px;">
						<input class="btn btn-danger" style="width: 200px;" type="submit" value="提交" />
					</div>
					
					<ttBox>
						hahahah
					</ttBox>
				</form>
			</div>
		</div>
	</body>

</html>

<script>
	$.ajax({
		type: "post",
		url: "http://localhost:9090/findDepa",
		"success": function(obj) {
			//debugger; 断点
			var depas = obj.data;
			if(depas != null) {
				$("#depaHigher").html("");
				for(var i = 0; i < depas.length; i++) {
					$("#depaHigher").append("<option value='" + depas[i].id + "'>" + depas[i].depaName + "</option>")
				}
			}
		},
		"dataType": "json",
		async: true
	});

	$("#addDepa").submit(function(e) {
		e.preventDefault();
		var $self = $(this);
		$.ajax({
			type: "post",
			url: "http://localhost:9090/addDepa",
			"data": $self.serialize(),
			"success": function(obj) {
				//debugger; 断点
				//debugger;
				if(obj.data) {
					window.wxc.xcConfirm(obj.msg, "success");
				} else {
					window.wxc.xcConfirm(obj.msg, "error");
				}
			},
			"dataType": "json",
			async: true
		});
	})
</script>